﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="SendTicket.aspx.cs" Inherits="University.Workshop.WebApp.SendTicket" ValidateRequest="false" EnableEventValidation="true"%>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div style=' margin-bottom:20px;background-color: #4b6c9e; color: White;'>
        <h4 style='margin-top: 4px; font-size: large; color: White'>
           &nbsp;>Ticket information
        </h4>
    </div>
    <asp:MultiView runat=server ID="multiView" ActiveViewIndex="0">
    <asp:View ID="TicketView" runat="server">
    <div>
    <table>
        <tbody>
            <tr>
                <td style='width: 125px;'>
                </td>
                <td  style=' width:120px; text-align:right;'>
                    <label > * Title of the Issue:</label>
                </td>
                <td style='width: 425px'>
                    <asp:TextBox runat=server ID=TbIssue Width=425 MaxLength="50"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td style=' vertical-align:top; text-align:right;'>
                    <label>* Description:</label>
                </td>
                <td>
                    <asp:TextBox ID="txtContent" TextMode="MultiLine" Height="170" Width="425" runat="server" MaxLength="500" onKeyUp="Count(this,500)" onChange="Count(this,500)"></asp:TextBox>
                    <script type="text/javascript">
                        function Count(text, long) {
                            var maxlength = new Number(long);
                            if (text.value.length > maxlength) {
                                text.value = text.value.substring(0, maxlength);
                                alert(" You can put only up to " + long + " chars");
                            }
                        }
                    </script>
                </td>
            </tr>
            <tr>
                <td></td>
                <td style='text-align:right;'>
                    <label>* Related Purchase:</label>
                </td>
                <td style=' background-color:#4b6c9e; height:20px'>
                    <asp:Label runat=server id=ProductName style=' color:White; font-family:Segoe UI; font-variant: small-caps; font-size:15px;' Text="&nbsp;No product purchase selected" />
                </td>
                <td>
                <asp:Button runat=server onmouseover="this.style.background='#3670C7'" 
                        onmouseout="this.style.background='#4b6c9e'" 
                        style=' background-color:#4b6c9e; color:White;font-family:Segoe UI; font-variant: small-caps; font-size:15px; height:25px; width:210px' 
                        Text = "Select another purchase" onclick="Unnamed1_Click" />
                </td>
            </tr>
            <tr style=' height:3px'><td></td></tr>
            <tr>
                <td>
                </td>
                <td style=' vertical-align:top; text-align:right;'>
                    <label>Option related to the case:</label>
                </td>
                <td style='border: 1px activeborder solid; border-style:dashed ; vertical-align:top'>
                    <table>
                    <tbody>
                        <tr>
                            <td style=' width:160px'>
                                <asp:RadioButton GroupName="IssueTipe" runat=server ID=NoSpecific 
                                    Text="Not specified" Checked=true oncheckedchanged="NoSpecific_CheckedChanged"/>
                                <br />
                                <asp:RadioButton GroupName="IssueTipe" runat=server ID=ProductNoArrives 
                                    Text="Product doesn't arrives" 
                                    oncheckedchanged="ProductNoArrives_CheckedChanged"/>
                                <br />
                                <asp:RadioButton GroupName="IssueTipe" runat=server ID=DamagedProduct 
                                    Text="Damaged product" oncheckedchanged="DamagedProduct_CheckedChanged"/>
                                 <br />
                                <asp:RadioButton GroupName="IssueTipe" runat=server ID=FakeProduct 
                                    Text="Fake product" oncheckedchanged="FakeProduct_CheckedChanged" />
                                <br />
                                <asp:RadioButton GroupName="IssueTipe" runat=server ID=OtherIssue 
                                    Text="Other kind of issue" oncheckedchanged="OtherIssue_CheckedChanged" />
                            </td>
                            <td style=' vertical-align:top'>
                                <label style='color:ActiveBorder;font-style:italic; '>This information will help us decide the priority of the case.</label>
                            </td>
                        </tr>
                    </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td></td>
                <td></td>
                <td>
                    <table>
                    <tbody>
                        <tr>
                            <td><label style='color:ActiveBorder;font-style:italic; '>* Obligatory fields.</label></td>
                            <td><asp:Label runat=server ID=LblMessage ForeColor=Red></asp:Label></td>
                        </tr>
                    </tbody>
                    </table>
                </td>
                <td>
                    <asp:Button Text="Send ticket" runat=server ID=SendTicketBtn 
                        onmouseover="this.style.background='#3670C7'" 
                        onmouseout="this.style.background='#4b6c9e'" 
                        style=' background-color:#4b6c9e; color:White;font-family:Segoe UI; font-variant: small-caps; font-size:15px; height:25px;' 
                        onclick="SendTicketBtn_Click">
                </asp:Button>
                </td>
            </tr>
        </tbody>
    </table>
    </div>
    </asp:View>
    <asp:View runat=server ID="PurchasesView">
    <div>
        <table>
            <tbody>
                <tr>
                    <td style=' width:220px'>
                    </td>
                    <td style='width: 470px; border:1px black solid;'>
                    <table>
                    <tbody>
                        <tr>
                            <td style=' width:450px;'>
                                <h4 style='margin-top: 4px; font-size: large; background-color: #4b6c9e; color: White;
                                    height: 22px;'>
                                    &nbsp;Select related purchase
                                </h4>
                            </td>
                            <td style=' vertical-align:bottom;'>
                                <asp:Button Text="X" runat=server ID=CloseBtn 
                        onmouseover="this.style.background='#3670C7'" 
                        onmouseout="this.style.background='#4b6c9e'" 
                            style=' background-color:#4b6c9e; color:White;font-family:Segoe UI; font-variant: small-caps; font-size:15px; height:24px;' 
                            onclick="CloseBtn_Click">
                        </asp:Button>
                            </td>
                        </tr>
                        <tr>
                            <td style="height: 150px; vertical-align: top">
                                <asp:DataList ID="testDL" runat="server" Width="434px" OnItemCommand="DL_ItemCommand" >
                                    <HeaderTemplate>
                                        <table style='border-collapse:collapse; border:1 ; width="100%;'>
                                            <thead bgcolor="#4b6c9e" style="font-weight: bold; color: white">
                                                <td style=' border-right: 1px white solid'>
                                                    Product Name
                                                </td>
                                                <td style=' border-right: 1px white solid'>
                                                    Price
                                                </td>
                                                <td style=' border-right: 1px white solid'>
                                                    Currency
                                                </td>
                                                <td style=' border-right: 1px white solid'>
                                                    Quantity
                                                </td>
                                                <td>
                                                    Seller
                                                </td>
                                            </thead>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <tr style='color:Black; background-color:White ; border: 1px #3A4F63 solid;' <%# TRJavaScript(Container) %>>
                                            <td style=' border-right: 1px #3A4F63 solid'>
                                                <asp:Button Style="display: none;" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"OrderId")%>'
                                                    CausesValidation="false" ID="HiddenButton" runat="server" Text="View"></asp:Button>
                                                <%# DataBinder.Eval(Container.DataItem, "ProductBought.Name")%>
                                            </td>
                                            <td style=' border-right: 1px #3A4F63 solid'>
                                                <%# DataBinder.Eval(Container.DataItem, "ProductBought.Price")%>
                                            </td>
                                            <td style=' border-right: 1px #3A4F63 solid'>
                                                <%# DataBinder.Eval(Container.DataItem, "ProductBought.Currency")%>
                                            </td>
                                            <td style=' border-right: 1px #3A4F63 solid'>
                                                <%# DataBinder.Eval(Container.DataItem, "Quantity")%>
                                            </td>
                                            <td>
                                                <%# DataBinder.Eval(Container.DataItem, "Seller")%>
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        </table>
                                    </FooterTemplate>
                                </asp:DataList>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table>
                                    <tbody>
                                        <tr>
                                            <td style=' width:120px'></td>
                                            <td><h3 id=ShowContent runat=server style=' margin-top:0px'>Showing
                                            </h3></td>
                                            <td>
                                                <asp:Button runat="server" ID="PrevButton" Text="<- Prev." OnClick="PrevButton_Click" />
                                            </td>
                                            <td>
                                                <asp:Button runat="server" ID="NextButton" Text="Next ->" OnClick="NextButton_Click" />
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                    </tbody>
                    </table>
                    </td>
                </tr>
            </tbody>
        </table>   
    </div>
    </asp:View>
    </asp:MultiView>
</asp:Content>
